package com.tong.lib_base.ft_my.service.impl;

import android.content.Context;

import androidx.fragment.app.Fragment;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.launcher.ARouter;
import com.tong.lib_base.base.AbcFragmentVM;
import com.tong.lib_base.ft_main.service.MainService;
import com.tong.lib_base.ft_main.service.impl.MainImpl;
import com.tong.lib_base.ft_my.service.MyService;

/**
 * author:liuzhitong
 * date:2022/3/2
 * description:对“我的页面”被调用的封装
 */
public class MyImpl {
    /**
     * ARouter的自动注入
     * （自动接线）
     * */
    @Autowired(name = "/my/my_service")
    protected MyService mMyService;

    private static MyImpl mMyImpl = null;

    public static MyImpl getInstance() {
        if (mMyImpl == null) {
            synchronized (MainImpl.class) {
                if (mMyImpl == null) {
                    mMyImpl = new MyImpl();
                }
                return mMyImpl;
            }
        }
        return mMyImpl;
    }
    //必须有这句话，和eventbus类似
    private MyImpl() {
        //初始化LoginService
        ARouter.getInstance().inject(this);
    }

    public Fragment getMyFragInstance(Context context) {
        return mMyService.getMyFragInstance(context);
    }
}
